Skip to content

Fix GH-18422: int overflow in php_date_llabs#21638

Open
iliaal wants to merge 1 commit intophp:masterfrom
iliaal:fix/gh-18422-date-llabs-overflow
Open

Fix GH-18422: int overflow in php_date_llabs#21638
iliaal wants to merge 1 commit intophp:masterfrom
iliaal:fix/gh-18422-date-llabs-overflow

Conversation

@iliaal
Copy link
Copy Markdown
Contributor

@iliaal iliaal commented Apr 4, 2026

php_date_llabs negates with -i, which is UB when i is LLONG_MIN. Cast to unsigned long long before negating and changed the return type to match. Updated Y/x/X format call sites from %lld to %llu.

Fixes #18422

@iliaal iliaal force-pushed the fix/gh-18422-date-llabs-overflow branch from 8068a48 to de9d934 Compare April 4, 2026 19:59
php_date_llabs negated its argument with -i, which is UB when i is
LLONG_MIN. Cast to uint64_t before negating and use stdint types
throughout. Updated Y/x/X format call sites to PRIu64.

Closes phpGH-18422
@iliaal iliaal force-pushed the fix/gh-18422-date-llabs-overflow branch from de9d934 to 2f19e2f Compare April 4, 2026 20:05
@iliaal iliaal requested a review from iluuu1994 April 4, 2026 20:45
Copy link
Copy Markdown
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but Derick is codeowner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

int overflow in Date extension

2 participants